/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.auth.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;

/**
 * 实名记录请求对象
 *
 * @author BladeX
 * @since 2024-04-27
 */
@Data
@Slf4j
@Schema(description = "实名记录请求对象")
public class RealNameAuthEntry implements Serializable {

	private static final long serialVersionUID = 1L;

	@Schema(description = "微信初始化授权code")
	private String code;
	/**
	 * 真实姓名
	 */
	@Schema(description = "真实姓名")
	private String realName;
	/**
	 * 证件号码
	 */
	@Schema(description = "证件号码")
	private String identificationCard;
	/**
	 * 真实姓名
	 */
	@Schema(description = "实名手机号")
	private String realNamePhone;
	/**
	 * 租户id
	 */
	@Schema(description = "租户id")
	private String tenantId;
	/**
	 * 用户uuId
	 */
	@Schema(description = "用户uuId")
	private String uuId;
	/**
	 * 代理商公众号的openid
	 */
	@Schema(description = "代理商公众号的openid")
	private String openId;
	/**
	 * 代理商的openid对应的主键key
	 */
	@Schema(description = "代理商的openid对应的主键key")
	private Integer openidKey;
	/**
	 * 加密身份信息
	 */
	@Schema(description = "加密身份信息")
	private String encryptedIdentityData;

	public void setEncryptedIdentityData(String encryptedIdentityData) {
		log.info("用户实名提交的连接:{}",encryptedIdentityData);
		int t1 = encryptedIdentityData.indexOf("TT_");
		int t2 = encryptedIdentityData.indexOf("_TT");
		String substring = encryptedIdentityData.substring(t1 + 3, t2);
		long l = Long.parseLong(substring);
		long l1=l-123456L;
		log.info("用户身份uid:{},处理后的uid:{}",l,l1);
		this.uuId=String.valueOf(l1);
	}


	public static void main(String[] args) {
		String encryptedIdentityData ="http://qy.mzshangwu.com.cn/?code=071YOmll2IFizd4nEBml2JUx9y0YOmlT&state=TT_20240603152966507_TT#/index";
		log.info("用户实名提交的连接:{}",encryptedIdentityData);
		int t1 = encryptedIdentityData.indexOf("TT_");
		int t2 = encryptedIdentityData.indexOf("_TT");
		String substring = encryptedIdentityData.substring(t1 + 3, t2);
		long l = Long.parseLong(substring);
		long l1=l+123456L;
		log.info("用户身份uid:{},处理后的uid:{}",l,l1);
		long l2=l1-123456L;
		log.info("用户身份uid:{},还原后的uid:{}",l,l2);

	}
}
